<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>网上书城-首页</title>
    <!-- shortcut icon导入ico图标 -->
    <link rel="shortcut icon" href="image/favicon.ico" />
    <!-- stylesheet导入css文件 -->
    <link rel="stylesheet" href="css/index.css" />
    <!-- 导入vue框架 -->
    <script src="js/vue.js"></script>
    <!-- 导入饿了么框架 -->
    <script src="js/index.js"></script>
    <!-- 导入axios异步框架 -->
    <script src="js/axios.min.js"></script>
    <style>
      html,
      body {
        margin: 0px;
      }

      .el-header,
      .el-footer {
        background-color: #b3c0d1;
        color: #333;
        text-align: center;
        line-height: 60px;
      }

      .el-aside {
        background-color: #545c64;
        color: #333;
        text-align: center;
      }

      .el-main {
        background-color: #e9eef3;
        color: #333;
        text-align: center;
        line-height: 160px;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <el-container style="height: 100%; position: absolute; width: 100%">
        <el-aside width="210px">
          <el-avatar :size="70" :src="face"></el-avatar>
          <el-menu
            default-active="2"
            style="border: none"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            @select="selectMenu"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
          >
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-setting"></i>
                <span>系统管理</span>
              </template>
              <el-menu-item-group>
                <!-- <template slot="title">分组一</template> -->
                <el-menu-item index="book">图书管理</el-menu-item>
                <el-menu-item index="type">分类管理</el-menu-item>
                <el-menu-item index="1-3">XXX管理</el-menu-item>
                <el-menu-item index="1-4">XXX管理</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-setting"></i>
                <span>图书管理</span>
              </template>
              <el-menu-item-group>
                <!-- <template slot="title">分组一</template> -->
                <el-menu-item index="2-1">图书管理</el-menu-item>
                <el-menu-item index="2-2">分类管理</el-menu-item>
                <el-menu-item index="2-3">XXX管理</el-menu-item>
                <el-menu-item index="2-4">XXX管理</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-container>
          <el-header>
            <div style="text-align: left; font-size: 20px">图书管理系统</div>
          </el-header>
          <el-main style="overflow: hidden">
            <iframe
              name="main"
              :src="page"
              frameborder="0"
              width="100%"
              height="100%"
            ></iframe>
          </el-main>
          <el-footer
            >江西思诚科技有限公司 赣ICP备17006097号-2 CopyRight©2014 -
            2020</el-footer
          >
        </el-container>
      </el-container>
    </div>
    <script>
      // 使用vue框架，
      var app = new Vue({
        el: "#app", // 要托管的根节点
        methods: {
          handleOpen(key, keyPath) {
            console.log(key, keyPath);
          },
          handleClose(key, keyPath) {
            console.log(key, keyPath);
          },
          selectMenu(key, keyPath) {
            this.page = key + ".html";
          },
        },
        data() {
          return {
            face: "image/default.png",
            page: "welcome.html",
          };
        },
        created() {
          var token = localStorage.getItem("token");
          console.log(token);
          if (!token) {
            localStorage.setItem("letter", 1);
            location = "login.html";
          }
        },
      });
    </script>
  </body>
</html>
